#coding=utf-8

import zipfile
import os

# 压缩文件到指定目录
def zipToFile(sourcePath,zipPath):
    f = zipfile.ZipFile(zipPath, 'w', zipfile.ZIP_DEFLATED)
    for dirpath, dirnames, filenames in os.walk(sourcePath):
        for filename in filenames:
            print (filename)
            f.write(os.path.join(dirpath, filename))
    f.close()